package com.example.domain.network

import com.example.domain.model.Product
import com.example.domain.model.LoginRes
import kotlinx.serialization.InternalSerializationApi

interface NetworkService {
  suspend fun getProducts(category:String?): ResultWrapper<List<Product>>
  suspend fun getCategories(): ResultWrapper<List<String>>
  @OptIn(InternalSerializationApi::class)
  suspend fun login(username: String, password: String): ResultWrapper<LoginRes>
}

sealed class ResultWrapper<out T> {
  data class Success<out T>(val value: T) : ResultWrapper<T>()
  data class Failure(val error: Exception) : ResultWrapper<Nothing>()
}